package com.qsn.tool.common.exception;

/**
 * 自定义异常枚举
 */
public enum ResultEnum implements BaseErrorInfoInterface {
    /**
     * 系统级
     */
    SUCCESS("0", "success"),
    SYSTEM_ERROR("0001", "system error"),
    UNKNOWN_ERROR("0002", "unknown error"),

    /**
     * web层
     */
    // 找不到请求路径
    REQUEST_URL_ERROR("0010", "cannot find url"),
    // 请求方式错误
    REQUEST_METHOD_ERROR("0011", "request method not supported"),
    // 缺少请求参数
    REQUEST_PARAMS_ERROR("0012", "request params error"),

    /**
     * 请求方式
     */
    REQUIRE_GET_ERROR("0020", "request require GET method"),
    REQUIRE_POST_ERROR("0021", "request require POST method"),
    REQUIRE_PATCH_ERROR("0021", "request require PATCH method"),
    REQUIRE_PUT_ERROR("0021", "request require PUT method"),
    REQUIRE_DELETE_ERROR("0021", "request require DELETE method"),

    /**
     * util层（备用）
     */
    DATA_SIGN_FAIL("0030", "sign check fail"),//签名检查失败
    DATA_DECRYPT_FAIL("0031", "decrypt data fail"),//解密数据失败
    DATA_ENCRYPT_FAIL("0032", "encrypt data fail"),//加密数据失败
    UNSUPPORT_ENCRYPT_METHOD("0033", "un support encrypt method"),// 不支持加密方法

    /**
     * login业务（备用）
     */
    // 没有登录
    NOT_LOGIN("0040", "not login"),
    // 没有权限
    PERMISSION_DENY("0041", "permission deny"),
    // 参数错误
    PARAMS_ERROR("0042", "params error"),
    // 文件太大
    FILE_UPLOAD_LIMIT_SIZE("0043", "file size too large"),

    /**
     * 第三方中间间（备用）
     */
    SERVICE_NOT_FOUND("0050", "service not found"),//找不到service
    SERVICE_UNAUTHORIZED("0051", "service unauthorized"),//未经授权的service
    REQUEST_IP_UNAUTHORIZED("0052", "request ip unauthorized"),//请求ip未授权
    REQUEST_OUT_TIME("0053", "request timestamp is out of time"),//请求时间超时
    REQUEST_ERROR("0054", "request error"),//请求错误
    RESPONSE_DATA_NULL("0055", "response data null"),//相应数据为null


    ;


    /**
     * 错误码
     */
    private String resultCode;

    /**
     * 错误描述
     */
    private String resultMsg;

    ResultEnum(String resultCode, String resultMsg) {
        this.resultCode = resultCode;
        this.resultMsg = resultMsg;
    }

    @Override
    public String getResultCode() {
        return resultCode;
    }

    @Override
    public String getResultMsg() {
        return resultMsg;
    }

}